
package net.lab0.electron.ai;


public class GPMulNode
extends GPNode
{
    private GPNode a;
    private GPNode b;
    
    @Override
    public double getValue()
    {
        return a.getValue() * b.getValue();
    }
    
    @Override
    public String toString()
    {
        String ret = "";
        if (a instanceof GPAddNode)
        {
            ret += "(" + a + ")";
        }
        else
        {
            ret += a;
        }
        ret += " * ";
        
        if (b instanceof GPAddNode)
        {
            ret += "(" + b + ")";
        }
        else
        {
            ret += b;
        }
        
        return ret;
    }
    
    public GPMulNode(GPNode a, GPNode b)
    {
        this.a = a;
        this.b = b;
    }
}
